<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>三列布局(左右固定宽度，中间自适应)</title>
  <style>
    html,
    body {
      margin: 0;
      padding: 10px;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
    }

    /*第一种 flex 布局 */
    /* .container {
      width: 100%;
      height: 300px;
      display: flex;

    }

    .left {
      width: 100px;
      height: 100%;
      background-color: aqua;
    }

    .middle {
      height: 100%;
       flex: 1;自适应宽度 
      flex: 1;
      background-color: red;
    }

    .right {
      width: 100px;
      height: 100%;
      background-color: aqua;
    } */

    /*第二种方法 绝对定位法 */
    /* .container {
      width: 100%;
      height: 300px;
      position: relative;
    }
    .left {
      width: 100px;
      height: 100%;
      position:absolute;
      left: 0;
      top: 0;
      background-color: aqua;
    }
    块级盒子宽度自动充满
    .middle {
      height: 100%;
      margin: 0 100px;
      background-color: red;
    }

    .right {
      width: 100px;
      height: 100%;
      position:absolute;
      right: 0;
      top: 0;
      background-color: aqua;
    } */

    /*第三种 与第二种方法相似 float */
    /* .container {
      width: 100%;
      height: 300px;
    }
    .left {
      width: 100px;
      height: 100%;
      float: left;
      background-color: aqua;
    }
    块级盒子宽度自动充满
    .middle {
      height: 100%;
      margin: 0 100px;
      background-color: red;
    }
    .right {
      width: 100px;
      height: 100%;
      float:right;
      background-color: aqua;
    } */

    /* 第四种 */
    /* .container {
      width: 100%;
      height: 300px;
    }
    .left {
      width: 100px;
      height: 100%;
      float: left;
      background-color: aqua;
    }
    .middle {
      height: 100%;
      padding: 0 100px;
      background-color: red;
      box-sizing: border-box;
    }

    .right {
      width: 100px;
      height: 100%;
      float:right;
      background-color: aqua;
    } */

    /* 第五种 */


    .container {
      padding: 0 100px;
      height: 100px;
    }
    .left , .right  , .middle {
      float: left;
      position: relative;
    }
    .middle {
      width: 100%;
      height: 100%;
      background-color:red;
    }
    .left {
      width: 100px;
      height: 100px;
      margin-left: -100%;
      left:-100px;
      background-color: aqua;
    }
    .right {
      width: 100px;
      height: 100px;
      margin-left: -100px;
      right: -100px;
      background-color: aqua;
    }
  </style>
</head>

<body>
  <!-- 第一种 -->
  <!-- <div class="container">
    <div class="left"></div>
    <div class="middle"></div>
    <div class="right"></div>
  </div> -->

  <!-- 第二种 -->
  <!-- <div class="container">
    <div class="left"></div>
    <div class="middle"></div>
    <div class="right"></div>
  </div> -->

  <!-- 第三种  -->
  <!-- <div class="container">
    <div class="left"></div>
    <div class="right"></div>
    middle一定要放最后
    <div class="middle"></div>
  </div> -->

  <!-- 第四种 -->
  <!-- <div class="container">
    <div class="left"></div>
    <div class="right"></div>
    <div class="middle"></div>
  </div> -->

  <!-- 第五种  圣杯布局-->
  <div class="container">

    <div class="middle"></div>
    <div class="left"></div>
    <div class="right"></div>
  </div>
</body>

</html>